const Sequelize=require('sequelize');
const Model=Sequelize.Model;
const conf=require("./config");

class trajectory extends Model{}
class trajectoryXYZ extends Model{}


const sql=new Sequelize(...conf.sequelize);

trajectory.init({
    processid: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },
    stuid: {
        type: Sequelize.INTEGER,
        allowNull: true
    },
    dataid: {
        type: Sequelize.INTEGER,
        allowNull: true
    },
    radius: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },
    angle: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },
    err: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },

}, {
    sequelize: sql, modelName: "trajectory",freezeTableName:true,timestamps:false
});

trajectoryXYZ.init({
    processid: {
        type: Sequelize.INTEGER,
        allowNull: false,
    },
    stuid: {
        type: Sequelize.INTEGER,
        allowNull: true
    },
    dataid: {
        type: Sequelize.INTEGER,
        allowNull: true
    },
    x: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },
    y: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },
    z: {
        type: Sequelize.DECIMAL(20,10),
        allowNull: true
    },

}, {
    sequelize: sql, modelName: "trajectoryXYZ",freezeTableName:true,timestamps:false
});


module.exports={
    sql, trajectory, trajectoryXYZ
};
